package c.c.b.a.b.a.h;

import c.b.a.a.a;
import c.c.b.a.a.h;
import java.io.IOException;

/* compiled from: Http2 */
public final class e {
    public static final h a = h.d("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n");
    public static final String[] b = new String[]{"DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION"};
    public static final String[] c = new String[64];
    public static final String[] d = new String[256];

    static {
        String str;
        int i;
        int i2 = 0;
        int i3 = 0;
        while (true) {
            String[] strArr = d;
            if (i3 >= strArr.length) {
                break;
            }
            strArr[i3] = c.c.b.a.b.a.e.i("%8s", Integer.toBinaryString(i3)).replace(' ', '0');
            i3++;
        }
        String[] strArr2 = c;
        strArr2[0] = "";
        strArr2[1] = "END_STREAM";
        int[] iArr = new int[]{1};
        strArr2[8] = "PADDED";
        i3 = 0;
        while (true) {
            str = "|PADDED";
            if (i3 >= 1) {
                break;
            }
            i = iArr[i3];
            String[] strArr3 = c;
            strArr3[i | 8] = a.d(new StringBuilder(), strArr3[i], str);
            i3++;
        }
        strArr2 = c;
        strArr2[4] = "END_HEADERS";
        strArr2[32] = "PRIORITY";
        strArr2[36] = "END_HEADERS|PRIORITY";
        int[] iArr2 = new int[]{4, 32, 36};
        for (i = 0; i < 3; i++) {
            int i4 = iArr2[i];
            for (int i5 = 0; i5 < 1; i5++) {
                int i6 = iArr[i5];
                String[] strArr4 = c;
                int i7 = i6 | i4;
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(strArr4[i6]);
                stringBuilder.append('|');
                stringBuilder.append(strArr4[i4]);
                strArr4[i7] = stringBuilder.toString();
                i7 |= 8;
                stringBuilder = new StringBuilder();
                stringBuilder.append(strArr4[i6]);
                stringBuilder.append('|');
                strArr4[i7] = a.d(stringBuilder, strArr4[i4], str);
            }
        }
        while (true) {
            strArr2 = c;
            if (i2 < strArr2.length) {
                if (strArr2[i2] == null) {
                    strArr2[i2] = d[i2];
                }
                i2++;
            } else {
                return;
            }
        }
    }

    public static IllegalArgumentException a(String str, Object... objArr) {
        throw new IllegalArgumentException(c.c.b.a.b.a.e.i(str, objArr));
    }

    public static String b(boolean z, int i, int i2, byte b, byte b2) {
        String str;
        String[] strArr = b;
        String i3 = b < strArr.length ? strArr[b] : c.c.b.a.b.a.e.i("0x%02x", Byte.valueOf(b));
        if (b2 == (byte) 0) {
            str = "";
        } else {
            if (!(b == (byte) 2 || b == (byte) 3)) {
                if (b == (byte) 4 || b == (byte) 6) {
                    str = b2 == (byte) 1 ? "ACK" : d[b2];
                } else if (!(b == (byte) 7 || b == (byte) 8)) {
                    String[] strArr2 = c;
                    String str2 = b2 < strArr2.length ? strArr2[b2] : d[b2];
                    str = (b != (byte) 5 || (b2 & 4) == 0) ? (b != (byte) 0 || (b2 & 32) == 0) ? str2 : str2.replace("PRIORITY", "COMPRESSED") : str2.replace("HEADERS", "PUSH_PROMISE");
                }
            }
            str = d[b2];
        }
        Object[] objArr = new Object[5];
        objArr[0] = z ? "<<" : ">>";
        objArr[1] = Integer.valueOf(i);
        objArr[2] = Integer.valueOf(i2);
        objArr[3] = i3;
        objArr[4] = str;
        return c.c.b.a.b.a.e.i("%s 0x%08x %5d %-13s %s", objArr);
    }

    public static IOException c(String str, Object... objArr) throws IOException {
        throw new IOException(c.c.b.a.b.a.e.i(str, objArr));
    }
}
